/*
 * @Author: Joel
 * @Date: 2025-04-10 14:05:53
 * @LastEditors: Joel
 * @LastEditTime: 2025-04-10 15:44:04
 * @FilePath: /gd32f303cct6/usr/board_driver/detect_voltage.h
 * @Description:
 * Copyright (C) 2025 YiJiaLink, All Rights Reserved.
 * 2025-04-10 14:05:53
 */
#ifndef __DETECT_VOLTAGE_H
#define __DETECT_VOLTAGE_H

/* 包含头文件代码 */

#include "gd32f30x.h"
#include "systick.h"

#if defined(__cplusplus)
extern "C"
{
#endif /*_cplusplus*/

#define DETECT_GPIO_CLK RCU_GPIOA

    enum DETECT_INPUT
    {
        EMS_ADC,
        VBAT_ADC,
        PUMP_ADC,
        DETECT_MAX
    };
/*EMS_ADC 硬件连接 */
#define EMS_ADC_GPIO_PORT GPIOA
#define EMS_ADC_PIN GPIO_PIN_1

/*VBAT_ADC 硬件连接 */
#define VBAT_ADC_GPIO_PORT GPIOA
#define VBAT_ADC_PIN GPIO_PIN_2

/*PUMP_ADC 硬件连接 */
#define PUMP_ADC_GPIO_PORT GPIOA
#define PUMP_ADC_PIN GPIO_PIN_3

    /* 功能打包 */
    struct detect_adc_func
    {
        /* data */
        void (*detect_adc_init)(void);
        uint16_t (*detect_result)(enum DETECT_INPUT DEVICE);
        void (*detect_stop)(void);
        uint16_t adc_value[DETECT_MAX];
    };

    struct detect_adc_func *detect_driver_init(void);

#if defined(__cplusplus)
}
#endif /*_cplusplus*/

#endif
/* el psy congroo */